﻿<!doctype html>
<html lang="zh-cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title th:text="${novel.name}">文章阅读</title>
    <style>
        html, body {
            padding: 0;
            margin: 0;
            height: 100%;
        }

        * {
            box-sizing: border-box;
        }

        body {
            font-family: Raleway, sans-serif;
            line-height: 1.7;
            -webkit-perspective-origin: 0 50%;
            perspective-origin: 0 50%;
            -webkit-perspective: 800px;
            perspective: 800px;
            background: #ffffff;
        }

        nav, main {
            transition: -webkit-transform 150ms ease-out;
            transition: transform 150ms ease-out, -webkit-transform 150ms ease-out;
        }

        nav {
            z-index: 100;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            width: 16em;
            background-color: #ffffff;
            -webkit-transform: translateX(-16em);
            transform: translateX(-16em);
        }

        nav.menu-active {
            -webkit-transform: translateX(0);
            transform: translateX(0);
        }

        nav.menu-hover {
            -webkit-transform: translateX(-15em);
            transform: translateX(-15em);
        }

        nav h1 {
            z-index: 100;
            display: block;
            position: absolute;
            top: 0;
            right: -60px;
            height: 60px;
            width: 60px;
            line-height: 60px;
            font-size: .8em;
            font-weight: 800;
            letter-spacing: 1px;
            color: #000000;
            text-transform: uppercase;
            text-align: center;
            background-color: #ffffff;
            cursor: pointer;
        }

        nav h1:hover {
            color: #43A047;
        }

        nav ul {
            margin: 0;
            padding: 0;
        }

        nav li {
            display: inline-block;
            padding: 0 1em;
            width: 100%;
            height: 60px;
            line-height: 60px;
            background-color: #ffffff;
        }

        nav li:nth-of-type(2n) {
            background-color: #eeeeee;
        }

        nav li a {
            text-align: center;
            color: #000000;
            display: block;
            height: 100%;
            width: 100%;
            text-decoration: none;
        }

        nav li a:hover {
            color: #ffffff;
            background: #43A047;
        }

        nav li a.activity {
            color: #ffffff;
            background: #43A047;
        }

        main {
            z-index: 0;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            display: flex;
            align-items: center;
            overflow: hidden;
            background-color: #7bba58;
            -webkit-transform-origin: 0 50%;
            transform-origin: 0 50%;
        }

        main:after {
            content: '';
            display: block;
            position: absolute;
            z-index: 1;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(255, 255, 255, 0.3));
            visibility: hidden;
            opacity: 0;
            transition: opacity 150ms ease-out, visibility 0s 150ms;
        }

        main.menu-active {
            border-radius: .001px;
            -webkit-transform: translateX(16em) rotateY(15deg);
            transform: translateX(16em) rotateY(15deg);
        }

        main.menu-active:after {
            visibility: visible;
            opacity: 1;
            transition: opacity 150ms ease-out, visibility 0s;
        }

        main.menu-hover {
            border-radius: .001px;
            -webkit-transform: translateX(1em) rotateY(1deg);
            transform: translateX(1em) rotateY(1deg);
        }

        main section {
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            margin: auto;
            padding: 1em 4em;
            max-width: 800px;
            overflow: auto;
            background-color: rgba(255, 255, 255, 0.5);
        }

        section h1 {
            font-weight: 800;
            text-transform: uppercase;
            font-size: 2em;
        }

        section p {
            display: inline-block;
            margin: 16px 0;
        }
    </style>
</head>
<body>
<nav>
    <h1>目录</h1>
    <ul>
        <li th:each="novelChapter,stats:${novelChapterList}">
            <a href="#"
               th:classappend="${page==stats.count?'activity':''}"
               th:href="${stats.count}"
               th:text="${novelChapter.name}">章节标题</a>
        </li>
    </ul>
</nav>

<main>
    <section>
        <h1 th:text="${novelChapterList[page -1].name}">章节标题</h1>
        <p th:text="${novelChapterList[page -1].content}">章节内容</p>
    </section>


</main>

<script th:src="@{/static/js/jquery-3.6.0.js}" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        let nav = $('nav');
        let menu = $('nav h1');
        let main = $('main');
        let open = false;

        menu.on('click', function () {
            open = !open;
            nav.toggleClass('menu-active');
            main.toggleClass('menu-active');
            nav.removeClass('menu-hover');
            main.removeClass('menu-hover');
        });

        menu.hover(
            function () {
                if (!open) {
                    nav.addClass('menu-hover');
                    main.addClass('menu-hover');
                }
            }, function () {
                nav.removeClass('menu-hover');
                main.removeClass('menu-hover');
            }
        );
    });
</script>
</body>
</html>
